$(function() {


  $('#login-form').on('submit',function(e) {
    e.preventDefault()
    $.ajax({
      method: 'POST',
      url: 'http://124.223.14.236:8060/admin/index/login',
      data:{
        login_name: $('.login [type=text]').val(),
        password: $('.login [type=password]').val()
      },
      success: function(res) {
        console.log(res);
        if(res.errno !== 0) return layer.msg('密码不正确')
        localStorage.setItem('token',res.data.token)
        location.href = './index.html'
      }
    })
  })
 
})